package com.efast.dmom.mgmt.service.mes.report.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.efast.cafe.framework.jdbc.JdbcDao;
import com.efast.cafe.portal.bean.query.QueryConditionBean;
import com.efast.dmom.mgmt.dao.mes.report.ReportVehicleRetrospectDao;
import com.efast.dmom.mgmt.entity.report.BeanCondition;
import com.efast.dmom.mgmt.entity.report.ReportVehicleRetrospect;
import com.efast.dmom.mgmt.service.mes.report.ReportVehicleRetrospectService;

@Service
public class ReportVehicleRetrospectServiceImpl implements ReportVehicleRetrospectService {
	
	@Autowired
	private ReportVehicleRetrospectDao reportVehicleRetrospectDao;
	@Autowired
	@Qualifier("jdbcDao")
	private JdbcDao jdbcDao;
	@Override
	public String getQualityInfo(String json) {
		// TODO Auto-generated method stub
		Map<?, ?> map = (Map<?, ?>) JSON.parse(json);
		String sql = "";
		String sql2 = "SELECT\r\n" + 
				"	plan.plan_order_no AS planOrderNO,\r\n" + 
				"	plant.plant_name_c AS plantNameC,\r\n" + 
				"	workshop.workshop_name_c AS workshopNameC,\r\n" + 
				"	substring_index(lot.part_no_version,'-',1) AS model,\r\n" + 
				"	lot.vin as vin,\r\n" + 
				"	lot.self_number as selfNumber,\r\n" + 
				"	defect.station AS station,\r\n" + 
				"	defect.area AS area,\r\n" + 
				"	defect.part AS part,\r\n" + 
				"	p.part_name_c AS partName,\r\n" + 
				"	defect.item AS item,\r\n" + 
				"	defect.defect_code AS defectCode,\r\n" + 
				"	date_format( defect.create_time, '%Y-%m-%d %H:%i:%s' ) AS createTime,\r\n" + 
				"	defect.create_user AS createUser,\r\n" + 
				"	defect.status AS status  \r\n" + 
				"   FROM qm_bas_defect_record defect	\r\n" + 
				"	left JOIN tw_bas_lot lot  ON lot.lot_name = defect.lot_name	\r\n" + 
				"	LEFT JOIN tw_bas_work_order o ON lot.order_id = o.order_id\r\n" + 
				"	LEFT JOIN inf_pp_plan plan ON o.plan_id = plan.id\r\n" + 
				"	LEFT JOIN tr_bas_product_config config ON config.operation_id = lot.operation_id\r\n" + 
				"	LEFT JOIN tm_bas_station station ON station.tm_bas_station_id = config.station_id\r\n" + 
				"	LEFT JOIN tm_bas_production_line pl ON pl.line_name = station.line_name\r\n" + 
				"	LEFT JOIN tm_bas_area area ON area.area_no = pl.area_no\r\n" + 
				"	LEFT JOIN tm_bas_workshop workshop ON workshop.workshop_no = area.workshop_no\r\n" + 
				"	LEFT JOIN tm_bas_plant plant ON workshop.tm_bas_plant_id = plant.tm_bas_plant_id	\r\n" + 
				"	LEFT JOIN tm_bas_part AS p ON p.part_no = defect.part  where 1=1  ";
		String selfLotName =""; 
		String vinLotName = "";
		String selfNumber = "";
		int start  = Integer.parseInt(map.get("start").toString());
		int length = Integer.parseInt(map.get("length").toString());
		HashMap<String,Object> hashMap = new HashMap<String, Object>();		 
	    hashMap.put("start",start);
		hashMap.put("length",length);
		JSONArray json3= (JSONArray) map.get("queryOpBeans");
		String jsonString2 = JSON.toJSONString(json3);
		List<BeanCondition> list = JSON.parseObject(jsonString2, new TypeReference<List<BeanCondition>>(){});
		for(int i=0;i<list.size();i++) {
			String key = list.get(i).getKey().trim();
			String value = list.get(i).getValue().trim();
			if(key!=null &&!"".equals(key)&& value!=null && !"".equals(value) ) {
				if(key.equals("lot.vin")) {
					//获取车辆合拼信息
					List<ReportVehicleRetrospect> spliceInfo = reportVehicleRetrospectDao.getSpliceInfo(value);
					if(spliceInfo!=null && spliceInfo.size()>0) {
						for (int j=0;j<spliceInfo.size();j++) {
							
							//说明为货车合拼之后的查询
							 vinLotName = spliceInfo.get(j).getLotName();						
							 selfNumber = spliceInfo.get(j).getSelfNumber();
							 List<ReportVehicleRetrospect> selfLotNameList = reportVehicleRetrospectDao.getSelfLotName(selfNumber);
							 if(selfLotNameList!=null &&selfLotNameList.size()>0) {
								 selfLotName= selfLotNameList.get(0).getLotName();
							 }
							 if(j==0) {
								 sql+="  defect.lot_name like '%"+vinLotName+"%' or defect.lot_name like '%"+selfLotName+"%' ";
							 }else {
								 sql+=" or defect.lot_name like '%"+vinLotName+"%' or defect.lot_name like '%"+selfLotName+"%' ";
							 }
							 
						}
						sql="and ("+sql+"or lot.vin like '%"+value+"%' or lot.self_number like '%"+value+"%' )";
					}else {
						sql+="and (lot.vin like '%"+value+"%' or lot.self_number like '%"+value+"%' )";
					}
					
				}else if(key.equals("defect.create_time")) {
					if(value!=null &&value.length()>0) {
						String[] split = value.split("~");
						if(split!=null &&split.length>1) {
							String beginTime = split[0];
							String endTime = split[1];
							sql+="and "+key+" between '"+beginTime+"' and '"+endTime+"'";
						}
						
					}
					
				}else {
					sql+="and "+key+" like '%"+value+"%'";
				}
			}
		}
		sql = sql2+sql;
		int count = jdbcDao.queryCount(sql);
		sql+=" order by defect.create_time DESC limit "+start+","+length;
		List<Map<String, Object>> result = jdbcDao.queryForListMap(sql);
		hashMap.put("totalRows",count);
	    hashMap.put("resultList", result);
		String jsonString = JSONObject.toJSONString(hashMap);
		return jsonString;
	}
	//质量信息报表
	@Override
	public String getRetrospectInfo(String json) {
		Map<?, ?> map = (Map<?, ?>) JSON.parse(json);
		String sql = "";
		String sql2 = "	SELECT\r\n" + 
				"		con.lot_name as lotName,\r\n" + 
				"		lot.vin as vin,\r\n" + 
				"		lot.self_number selfNumber,\r\n" + 
				"		con.consumed_part_no_version as consumedPartNoVersion,\r\n" + 
				"		con.opt_counter as optCounter,\r\n" + 
				"		con.company_code as companyCode,\r\n" + 
				"		part.part_no as partNo,\r\n" + 
				"	    part.part_name_c as partNameC,\r\n" + 
				"		con.consumed_part_sn as consumedPartSn,\r\n" + 
				"		con.consumed_qty as consumedQty,\r\n" + 
				"		con.comments as comments,\r\n" + 
				"		con.production_line as productionLine,\r\n" + 
				"		con.operation as operation,\r\n" + 
				"		con.route as route,\r\n" + 
				"		con.station_name as stationName,\r\n" + 
				"		con.create_time as createTime,\r\n" + 
				"		con.create_user as createUser,\r\n" + 
				"	  suppl.suppl_name_c as supplierName,\r\n" + 
				"	  substr( con.consumed_part_sn, 18 ) as productionCode,\r\n" + 
				"	  CONCAT_WS(\"-\",ruleItem.barcode_length,ruleItem.start_pattern,ruleItem.end_pattern) as rule,\r\n" + 
				"	  con.replace_consumed_part_sn as replaceConsumedPartSn,\r\n" + 
				"	  ppl.suppl_name_c as lastSupplierName,\r\n" + 
				"	  substr( con.replace_consumed_part_sn, 18 ) AS replaceProductionCode \r\n" + 
				"		FROM tw_bas_lot_consumpation as con\r\n" + 
				"	left join tw_bas_lot lot on con.lot_id=lot.lot_id\r\n" + 
				"	left JOIN tm_bas_part as part on con.consumed_part_no_version = part.part_no_version\r\n" + 
				"	left join tm_bas_suppl as suppl on suppl.suppl_no =substr(con.consumed_part_sn,13,5)\r\n" + 
				"	LEFT JOIN tr_bas_product_config as tbpc on con.route = tbpc.route_name and con.operation_id = tbpc.operation_id\r\n" + 
				"	LEFT JOIN tr_bas_product_cfg_bi as cfgbi on tbpc.product_config_id = cfgbi.product_config_id\r\n" +
				"	LEFT JOIN qm_bas_barcode_rule_item as ruleItem on ruleItem.rule_id = cfgbi.rule_id\r\n" +
				"	left JOIN  tm_bas_suppl as ppl on ppl.suppl_no =substr(con.replace_consumed_part_sn,13,5)\r\n" +
				"		where 1= 1 ";

		String selfLotName =""; 
		String vinLotName = "";
		String selfNumber = "";
		int start  = Integer.parseInt(map.get("start").toString());
		int length = Integer.parseInt(map.get("length").toString());
		HashMap<String,Object> hashMap = new HashMap<String, Object>();		 
	    hashMap.put("start",start);
		hashMap.put("length",length);
		JSONArray json3= (JSONArray) map.get("queryOpBeans");
		String jsonString2 = JSON.toJSONString(json3);
		List<BeanCondition> list = JSON.parseObject(jsonString2, new TypeReference<List<BeanCondition>>(){});
		for(int i=0;i<list.size();i++) {
			String key = list.get(i).getKey().trim();
			String value = list.get(i).getValue().trim();
			if(key!=null &&!"".equals(key)&& value!=null && !"".equals(value) ) {
				if(key.equals("lot.vin")) {
					//获取车辆合拼信息
					List<ReportVehicleRetrospect> spliceInfo = reportVehicleRetrospectDao.getSpliceInfo(value);
					if(spliceInfo!=null && spliceInfo.size()>0) {
						for (int j=0;j<spliceInfo.size();j++) {
							
							//说明为货车合拼之后的查询
							 vinLotName = spliceInfo.get(j).getLotName();						
							 selfNumber = spliceInfo.get(j).getSelfNumber();
							 List<ReportVehicleRetrospect> selfLotNameList = reportVehicleRetrospectDao.getSelfLotName(selfNumber);
							 if(selfLotNameList!=null &&selfLotNameList.size()>0) {
								 selfLotName= selfLotNameList.get(0).getLotName();
							 }
							 if(j==0) {
								 sql+="  con.lot_name like '%"+vinLotName+"%' or con.lot_name like '%"+selfLotName+"%' ";
							 }else {
								 sql+=" or con.lot_name like '%"+vinLotName+"%' or con.lot_name like '%"+selfLotName+"%' ";
							 }
							 
						}
						sql="and ("+sql+"or lot.vin like '%"+value+"%' or lot.self_number like '%"+value+"%' )";
					}else {
						sql+="and (lot.vin like '%"+value+"%' or lot.self_number like '%"+value+"%' )";
					}
					
				}else if(key.equals("con.create_time")) {
					if(value!=null &&value.length()>0) {
						String[] split = value.split("~");
						if(split!=null &&split.length>1) {
							String beginTime = split[0];
							String endTime = split[1];
							sql+="and "+key+" between '"+beginTime+"' and '"+endTime+"'";
						}
						
					}
					
				}else {
					sql+="and "+key+" like '%"+value+"%'";
				}
			}
		}
		sql = sql2+sql;
		int count = jdbcDao.queryCount(sql);
		sql+="GROUP BY con.create_time,con.consumed_part_no_version\r\n";
		sql+=" order by con.create_time DESC limit "+start+","+length;
		List<Map<String, Object>> result = jdbcDao.queryForListMap(sql);
		hashMap.put("totalRows",count);
		hashMap.put("resultList", result);
		String jsonString = JSONObject.toJSONString(hashMap);
		return jsonString;
	}
	@Override
	public String getHistoryInfo(String json) {
		Map<?, ?> map = (Map<?, ?>) JSON.parse(json);
		String sql = "";
		String sql2 = "SELECT\r\n" + 
				"	lot.vin AS vin,\r\n" + 
				"	lot.self_number AS selfNumber,\r\n" + 
				"	plan.plan_order_no AS planOrderNo,\r\n" + 
				"	workshop.workshop_name_c AS workshopNameC,\r\n" + 
				"	plant.plant_name_c AS plantNameC,\r\n" + 
				"	substring_index( lot.part_no_version, '-', 1 ) AS model,\r\n" + 
				"	his.state AS state,\r\n" + 
				"	station.station_no AS stationNo,\r\n" + 
				"	station.station_name AS stationName,\r\n" + 
				"	date_format( his.create_time, '%Y-%m-%d %H:%i:%s' ) AS createTime,\r\n" + 
				"	lot.last_update_user AS lastUpdateUser \r\n" + 
				"FROM\r\n" + 
				"	tw_bas_lot_history his\r\n" + 
				"	INNER JOIN tw_bas_lot lot ON his.lot_id = lot.lot_id\r\n" + 
				"	LEFT JOIN tw_bas_work_order o ON o.order_id = his.order_id\r\n" + 
				"	LEFT JOIN inf_pp_plan plan ON plan.id = o.plan_id\r\n" + 
				"	LEFT JOIN tr_bas_product_config config ON config.operation_id = lot.operation_id\r\n" + 
				"	LEFT JOIN tm_bas_station station ON station.tm_bas_station_id = config.station_id\r\n" + 
				"	LEFT JOIN tm_bas_production_line l ON l.tm_bas_production_line_id = station.line_id\r\n" + 
				"	LEFT JOIN tm_bas_area a ON a.tm_bas_area_id = l.tm_bas_area_id\r\n" + 
				"	LEFT JOIN tm_bas_workshop workshop ON workshop.tm_bas_workshop_id = a.tm_bas_workshop_id\r\n" + 
				"	LEFT JOIN tm_bas_plant plant ON plant.tm_bas_plant_id = workshop.tm_bas_plant_id where 1=1 ";

		String selfLotName =""; 
		String vinLotName = "";
		String selfNumber = "";
		int start  = Integer.parseInt(map.get("start").toString());
		int length = Integer.parseInt(map.get("length").toString());
		HashMap<String,Object> hashMap = new HashMap<String, Object>();		 
	    hashMap.put("start",start);
		hashMap.put("length",length);
		JSONArray json3= (JSONArray) map.get("queryOpBeans");
		String jsonString2 = JSON.toJSONString(json3);
		List<BeanCondition> list = JSON.parseObject(jsonString2, new TypeReference<List<BeanCondition>>(){});
		for(int i=0;i<list.size();i++) {
			String key = list.get(i).getKey().trim();
			String value = list.get(i).getValue().trim();
			if(key!=null &&!"".equals(key)&& value!=null && !"".equals(value) ) {
				if(key.equals("lot.vin")) {
					//获取车辆合拼信息
					List<ReportVehicleRetrospect> spliceInfo = reportVehicleRetrospectDao.getSpliceInfo(value);
					if(spliceInfo!=null && spliceInfo.size()>0) {
						for (int j=0;j<spliceInfo.size();j++) {
							
							//说明为货车合拼之后的查询
							 vinLotName = spliceInfo.get(j).getLotName();						
							 selfNumber = spliceInfo.get(j).getSelfNumber();
							 List<ReportVehicleRetrospect> selfLotNameList = reportVehicleRetrospectDao.getSelfLotName(selfNumber);
							 if(selfLotNameList!=null &&selfLotNameList.size()>0) {
								 selfLotName= selfLotNameList.get(0).getLotName();
							 }
							 if(j==0) {
								 sql+="  his.lot_name like '%"+vinLotName+"%' or his.lot_name like '%"+selfLotName+"%' ";
							 }else {
								 sql+=" or his.lot_name like '%"+vinLotName+"%' or his.lot_name like '%"+selfLotName+"%' ";
							 }
							 
						}
						sql="and ("+sql+"or lot.vin like '%"+value+"%' or lot.self_number like '%"+value+"%' )";
					}else {
						sql+="and (lot.vin like '%"+value+"%' or lot.self_number like '%"+value+"%' )";
					}
					
				}else if(key.equals("his.create_time")) {
					if(value!=null &&value.length()>0) {
						String[] split = value.split("~");
						if(split!=null &&split.length>1) {
							String beginTime = split[0];
							String endTime = split[1];
							sql+="and "+key+" between '"+beginTime+"' and '"+endTime+"'";
						}
						
					}
					
				}else {
					sql+="and "+key+" like '%"+value+"%'";
				}
			}
		}
		sql = sql2+sql;
		int count = jdbcDao.queryCount(sql);
		sql+=" order by his.create_time DESC limit "+start+","+length;
		List<Map<String, Object>> result = jdbcDao.queryForListMap(sql);
		hashMap.put("totalRows",count);
		hashMap.put("resultList", result);
		String jsonString = JSONObject.toJSONString(hashMap);
		return jsonString;
	}
	@Override
	public String getRepairInfo(String json) {
		Map<?, ?> map = (Map<?, ?>) JSON.parse(json);
		String sql = "";
		String sql2 ="SELECT\r\n" + 
				"	re.id AS id,\r\n" + 
				"	re.repairer AS repairer,\r\n" + 
				"	re.repair_code AS repairCode,\r\n" + 
				"	re.comments AS comments,\r\n" + 
				"	re.create_time AS createTime,\r\n" + 
				"	re.create_user AS createUser,\r\n" + 
				"	re.last_update_time AS lastUpdateTime,\r\n" + 
				"	re.last_update_user AS lastUpdateUser,\r\n" + 
				"	re.is_deleted AS isDeleted,\r\n" + 
				"	re.repair_code_group AS repairCodeGroup,\r\n" + 
				"	lot.vin as vin,\r\n" + 
				"	lot.self_number as selfNumber,\r\n" + 
				"	re.is_key_part AS isKeyPart,\r\n" + 
				"	re.bom_item_name AS bomItemName,\r\n" + 
				"	re.consumed_part_no_version AS consumedPartNoVersion,\r\n" + 
				"	re.consumed_part_sn AS consumedPartSn,\r\n" + 
				"	re.replaced_consumed_part_sn AS replacedConsumedPartSn,\r\n" + 
				"	re.part AS part,\r\n" + 
				"	part.part_no_version AS partNoVersion,\r\n" + 
				"	part.part_name_c AS partName,\r\n" + 
				"	lot.station_name AS stationName \r\n" + 
				"	FROM\r\n" + 
				"	qm_bas_defectrepair_record AS re\r\n" + 
				"	left JOIN tm_bas_part AS part ON part.part_no = re.part\r\n" + 
				"	left JOIN tw_bas_lot AS lot ON re.lot_name = lot.lot_name \r\n" + 
				"	where 1=1 ";

		String selfLotName =""; 
		String vinLotName = "";
		String selfNumber = "";
		int start  = Integer.parseInt(map.get("start").toString());
		int length = Integer.parseInt(map.get("length").toString());
		HashMap<String,Object> hashMap = new HashMap<String, Object>();		 
	    hashMap.put("start",start);
		hashMap.put("length",length);
		JSONArray json3= (JSONArray) map.get("queryOpBeans");
		String jsonString2 = JSON.toJSONString(json3);
		List<BeanCondition> list = JSON.parseObject(jsonString2, new TypeReference<List<BeanCondition>>(){});
		for(int i=0;i<list.size();i++) {
			String key = list.get(i).getKey().trim();
			String value = list.get(i).getValue().trim();
			if(key!=null &&!"".equals(key)&& value!=null && !"".equals(value) ) {
				if(key.equals("lot.vin")) {
					//获取车辆合拼信息
					List<ReportVehicleRetrospect> spliceInfo = reportVehicleRetrospectDao.getSpliceInfo(value);
					if(spliceInfo!=null && spliceInfo.size()>0) {
						for (int j=0;j<spliceInfo.size();j++) {
							
							//说明为货车合拼之后的查询
							 vinLotName = spliceInfo.get(j).getLotName();						
							 selfNumber = spliceInfo.get(j).getSelfNumber();
							 List<ReportVehicleRetrospect> selfLotNameList = reportVehicleRetrospectDao.getSelfLotName(selfNumber);
							 if(selfLotNameList!=null &&selfLotNameList.size()>0) {
								 selfLotName= selfLotNameList.get(0).getLotName();
							 }
							 if(j==0) {
								 sql+="  re.lot_name like '%"+vinLotName+"%' or re.lot_name like '%"+selfLotName+"%' ";
							 }else {
								 sql+=" or re.lot_name like '%"+vinLotName+"%' or re.lot_name like '%"+selfLotName+"%' ";
							 }
							 
						}
						sql="and ("+sql+"or lot.vin like '%"+value+"%' or lot.self_number like '%"+value+"%' )";
					}else {
						sql+="and (lot.vin like '%"+value+"%' or lot.self_number like '%"+value+"%' )";
					}
					
				}else if(key.equals("re.create_time")) {
					if(value!=null &&value.length()>0) {
						String[] split = value.split("~");
						if(split!=null &&split.length>1) {
							String beginTime = split[0];
							String endTime = split[1];
							sql+="and "+key+" between '"+beginTime+"' and '"+endTime+"'";
						}
						
					}
					
				}else {
					sql+="and "+key+" like '%"+value+"%'";
				}
			}
		}
		sql = sql2+sql;
		int count = jdbcDao.queryCount(sql);
		sql+=" order by re.create_time DESC limit "+start+","+length;
		System.out.println(sql);
		List<Map<String, Object>> result = jdbcDao.queryForListMap(sql);
		hashMap.put("totalRows",count);
		hashMap.put("resultList", result);
		String jsonString = JSONObject.toJSONString(hashMap);
		return jsonString;
	}
	
//	@Override
//	public String getVehicleCarInformation(QueryConditionBean queryConditionBean) {
//		List<QueryOpBean> queryOpBeans = queryConditionBean.getQueryOpBeans();
//		HashMap<String, Object> hashMap = new HashMap<String, Object>();
//		Assist assit = new Assist();
//		assit.setStartRow(queryConditionBean.getStart());
//		assit.setRowSize(queryConditionBean.getLength());
//		List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
//		String workShopName = "";
//		int count = 0;
//		if (queryOpBeans != null && queryOpBeans.size() > 0) {
//			for (QueryOpBean data : queryOpBeans) {
//				if (data.getKey().equals("workshopNameC") && data.getValue() != null && data.getValue().length() != 0) {
//					workShopName = data.getValue();
//				} else if (data.getValue() != null && data.getValue().length() != 0
//						&& !data.getKey().equals("IFNULL(lot.vin,lot.self_number")
//						&& !data.getKey().equals("workshopNameC")) {
//					if (data.getOpName().equals("包含")) {
//						assit.setRequires(Assist.andLike(data.getKey(), "%" + data.getValue() + "%"));
//					}
//					if (data.getOpName().equals("等于")) {
//						assit.setRequires(Assist.andEq(data.getKey(), data.getValue()));
//					}
//				} else if (data.getValue() != null && data.getValue().length() != 0
//						&& !data.getKey().equals("workshopNameC")
//						&& data.getKey().equals("IFNULL(lot.vin,lot.self_number")) {
//					if (data.getOpName().equals("包含")) {
//						assit.setRequires(Assist.andLike("lot.vin", "%" + data.getValue() + "%"));
//						assit.setRequires(Assist.orLike("lot.self_number", "%" + data.getValue() + "%"));
//						// 获取车辆合拼信息
//						List<ReportVehicleRetrospect> spliceInfo = reportVehicleRetrospectDao
//								.getSpliceInfo(data.getValue());
//						if (spliceInfo != null && spliceInfo.size() > 0) {
//							for (int j = 0; j < spliceInfo.size(); j++) {
//								// 说明为货车合拼之后的查询
//								String vinLotName = spliceInfo.get(j).getLotName();
//								String selfNumber = spliceInfo.get(j).getSelfNumber();
//								assit.setRequires(Assist.orEq("lot.vin", vinLotName));
//								assit.setRequires(Assist.orEq("lot.self_number", selfNumber));
//							}
//						}
//						if (data.getOpName().equals("等于")) {
//							assit.setRequires(Assist.andEq("lot.vin", data.getValue()));
//							assit.setRequires(Assist.orEq("lot.self_number", data.getValue()));
//							List<ReportVehicleRetrospect> spliceInfoByEqual = reportVehicleRetrospectDao
//									.getSpliceInfoByEqual(data.getValue());
//							if (spliceInfoByEqual != null && spliceInfoByEqual.size() > 0) {
//								for (int j = 0; j < spliceInfoByEqual.size(); j++) {
//									// 说明为货车合拼之后的查询
//									String vinLotName = spliceInfo.get(j).getLotName();
//									String selfNumber = spliceInfo.get(j).getSelfNumber();
//									assit.setRequires(Assist.orEq("lot.vin", vinLotName));
//									assit.setRequires(Assist.orEq("lot.self_number", selfNumber));
//								}
//							}
//						}
//					}
//				}
//			}
//		}
//		if (queryOpBeans.size() == 0 || workShopName == null || workShopName.length() == 0) {
//			List<Map<String, Object>> weldingList = reportVehicleRetrospectDao.getVehicleCarInformation("焊装车间", assit);
//			int count1 = reportVehicleRetrospectDao.getVehicleCarInformationCount("焊装车间", assit);
//			List<Map<String, Object>> coatingList = reportVehicleRetrospectDao.getVehicleCarInformation("涂装车间", assit);
//			int count2 = reportVehicleRetrospectDao.getVehicleCarInformationCount("涂装车间", assit);
//			List<Map<String, Object>> finalList = reportVehicleRetrospectDao.getVehicleCarInformation("总装车间", assit);
//			int count3 = reportVehicleRetrospectDao.getVehicleCarInformationCount("总装车间", assit);
//			count = count1 + count2 + count3;
//			if (weldingList != null && weldingList.size() > 0) {
//				for (Map<String, Object> map : weldingList) {
//					result.add(map);
//				}
//			}
//			if (coatingList != null && coatingList.size() > 0) {
//				for (Map<String, Object> map : coatingList) {
//					result.add(map);
//				}
//			}
//			if (finalList != null && finalList.size() > 0) {
//				for (Map<String, Object> map : finalList) {
//					result.add(map);
//				}
//			}
//		} else if (queryOpBeans.size() > 0 && workShopName != null) {
//			List<Map<String, Object>> list = reportVehicleRetrospectDao.getVehicleCarInformation(workShopName, assit);
//			count = reportVehicleRetrospectDao.getVehicleCarInformationCount(workShopName, assit);
//			if (list != null && list.size() > 0) {
//				for (Map<String, Object> map : list) {
//					result.add(map);
//				}
//			}
//		}
//		hashMap.put("resultList", result);
//		hashMap.put("totalRows", count);
//		String jsonString = JSONObject.toJSONString(hashMap);
//		return jsonString;
//	}
	
	/**
	 * 获取计划完成率
	 * 
	 */
	@Override
	public String getPlannedCompletionRate(QueryConditionBean queryConditionBean) {
//		NumberFormat numberFormat = NumberFormat.getInstance();
//		numberFormat.setMaximumFractionDigits(2);
//		completePercent=numberFormat.format((completed/(totalPlans*1.0))*100);
//		List<PlannedCompletionRateBean> plannedCompletionRateBean = reportVehicleRetrospectDao.getPlannedCompletionRate();
//		//计算各车间计划完成率
//		//冲压车间 SS-BS-PS-AS
//		List<PlannedCompletionRateBean> SSWorkshopRateList = reportVehicleRetrospectDao.selectWorkshopRate("BS");
		return null;
	}
	
	/**
	 * 获取各质量门指标
	 */
	@Override
	public String getEachQualityGateDoorIndex(QueryConditionBean queryConditionBean) {
		
		return null;
	}
	@Override
	public String getVehicleCarInformation(QueryConditionBean queryConditionBean) {
		// TODO Auto-generated method stub
		return null;
	}
	
}

